{% extends 'base.html' %}
{% load humanize %}
{% block seo %}
    <title>{% if isreaded %}（新消息）{% endif %}{% if thread.title %}{{ thread.title }}{% else %}
        {{ thread.contents|slice:"35" }}{% if thread.contents|length > 35 %}...{% endif %}
    {% endif %} - {{ web_config.title }}</title>
    <meta name="keywords" content="{{ web_config.keywords }}">
    <meta name="description" content="{{ thread.contents }}">
{% endblock %}
{% block header %}
    {% include 'common/header.html' %}
    <link rel="stylesheet" href="/static/css/default.css">
{% endblock %}
{% block content %}
    <div uk-grid>
        <div class="uk-width-2-3@m fead-area">
            {% if user %}
                <div class="post-newer mt-lg-2">
                    <div class="post-new" uk-toggle="target: body ; cls: post-focus">
                        <div class="post-new-media">
                            <div class="post-new-media-user">
                                {% if user and user.usravatr %}
                                    <img src="{{ user.usravatr }}" alt="">
                                {% else %}
                                    <img src="{{ web_config.default }}" alt="">
                                {% endif %}
                            </div>
                            <div class="post-new-media-input">
                                <input type="text" class="uk-input" id="temp-textarea" placeholder="这里是回复区，小伙子神评在等着你！">
                            </div>
                        </div>
                        <hr>
                        <div class="post-new-type">
                            <a href="#">
                                <img src="/static/images/icons/live.png"
                                     alt="">视频 </a>
                            <a href="#">
                                <img src="/static/images/icons/photo.png"
                                     alt="">图片 </a>
                            <a href="#" class="uk-visible@s">
                                <img src="/static/images/icons/tag-friend.png"
                                     alt="">标签 </a>
                            <a href="#">
                                <img src="/static/images/icons/reactions_wow.png"
                                     alt="">表情 </a>
                        </div>
                    </div>
                    <div class="post-pop">
                        <div class="post-new-overyly" uk-toggle="target: body ; cls: post-focus"></div>
                        <div class="post-new uk-animation-slide-top-small">
                            {% csrf_token %}
                            <div class="post-new-header">
                                <h4>回复主题！</h4>
                                <span class="post-new-btn-close" uk-toggle="target: body ; cls: post-focus"
                                      uk-tooltip="title:Close; pos: left "></span>
                            </div>
                            <div class="post-new-media mb-0">
                                <div class="post-new-media-user">
                                    {% if user and user.usravatr %}
                                        <img src="{{ user.usravatr }}" alt="">
                                    {% else %}
                                        <img src="{{ web_config.default }}" alt="">
                                    {% endif %}
                                </div>
                                <div class="post-new-media-input">
                        <textarea class="OwO-textarea uk-textarea ml-2" style="margin-bottom: 0"
                                  placeholder="这里是回复区，小伙子神评在等着你！"></textarea>
                                    <input type="hidden" id="comment-parentid" value="">
                                </div>
                            </div>
                            <div class="post-new-tab-nav">
                                <a href="javascript:void(0);">
                                    <div uk-form-custom="" class="uk-form-custom">
                                        <input type="file" id="uploadFile">
                                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                                             viewBox="0 0 24 24">
                                            <path fill="#4db3f6"
                                                  d="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z"></path>
                                        </svg>
                                        <span id="uploadFileName">上传图片</span>
                                    </div>
                                </a>
                            </div>
                            <div class="uk-flex uk-flex-between">
                                <a href="javascript:void(0);" data-thread="{{ thread.id }}" onclick="comment()"
                                   id="comment-submit"
                                   class="button primary px-6 right-side">回复！
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            {% endif %}
            <div class="post" style="position: relative">
                {% if thread.thauthor.backswih %}
                    <div class="post-night">
                        <div style="position: absolute; height: 100%; width: 100%; z-index: 98; background-color: black; border-radius: 6px; opacity: 0.45"></div>
                        <div style="position: absolute; height: 100%; width: 100%; z-index: 97; background-image: url({{ thread.thauthor.userback }}); background-position: center center; background-size: cover; border-radius: 6px;"></div>
                        <div style="position: relative; z-index: 99">
                            {% include 'common/doneitem.html' %}
                        </div>
                    </div>
                {% else %}
                    <div style="position: relative; z-index: 99">
                        {% include 'common/doneitem.html' %}
                    </div>
                {% endif %}
            </div>
            {% include 'common/pagination.html' %}
        </div>
        {% include 'common/expand.html' %}
    </div>
{% endblock %}
{% block footer %}
    {% if user and not user.usersage %}
        <script>
            $(document).ready(function () {
                window.location.href = "/profile/"
            })
        </script>
    {% endif %}
    {% include 'common/footer.html' %}
{% endblock %}